<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <input type="text" value="123" data-id="0" data-name="1">
    <input type="password">
    <script>

        const input = document.querySelector('[value]')//这个意思是选择有value属性的input
        console.log(input);
        console.log(input.dataset);//可以得到自定义属性 id和name都可以获取
    </script>
</body>

</html>